using System;
using System.Collections.Generic;
using System.Data.Linq;
using System.Linq;
using System.Text;
using MimeCloud.AssetManagement.Business.Interface;
using System.Data.Linq.Mapping;

namespace MimeCloud.AssetManagement.DataProvider.Astoria.Entities.Data
{
    [Table(Name="T_Asset")]
    public class Asset
    {
        public Asset()
        {
            _metadata = new EntitySet<Data.AssetMetadata>();
            _status = new EntityRef<Status>();
            _contentList = new EntitySet<Data.AssetContent>();
            InstanceID = Guid.NewGuid();
            ID = Int32.MinValue;
        }
        [Column(Name="CreationDate_DT",IsDbGenerated=true)]
        public DateTime CreationDate { get; set; }

        [Column(Name="CreatorID_NVC")]
        public string CreatorID { get; set; }

        [Column(Name="Asset_IDPK", IsPrimaryKey=true,IsDbGenerated=true)]
        public int ID { get; set; }
        
        [Column(Name="LatestEditorID_NVC")]
        public string LatestEditorID { get; set; }

        [Column(Name="Name_NVC")]
        public string Name { get; set; }

        [Column(Name="Source_NVC")]
        public string Source { get; set; }

        [Column(Name="StatusID_FK")]
        public int StatusID {get;set;}

        [Column(Name = "UpdatedDate_DT", IsDbGenerated = true,UpdateCheck = UpdateCheck.Always, AutoSync = AutoSync.Always)]
        public DateTime UpdatedDate { get; set; }

        [Association(ThisKey="StatusID",Storage="_status",IsForeignKey=true,OtherKey="ID")]
        public Status Status {get{return _status.Entity;}set{ _status.Entity = value;}}
        private EntityRef<Status> _status;// = new EntityRef<Status>();

        [Association(OtherKey="AssetID",ThisKey="ID",Storage="_metadata",IsForeignKey=true)]
        public EntitySet<AssetMetadata> AssetMetaDataListCast { get { return _metadata; } set { _metadata.Assign(value); } }
        internal EntitySet<AssetMetadata> _metadata;

        [Association(OtherKey="AssetID",ThisKey="ID",Storage="_contentList",IsForeignKey=true)]
        public EntitySet<Data.AssetContent> AssetContentListCast { get { return _contentList; } set { _contentList.Assign(value); } }
        internal EntitySet<Data.AssetContent> _contentList;

        public Guid InstanceID {get; set;}

        


    }
}
